﻿using System.Diagnostics;

namespace UIOC {

#if !DISABLE_DEBUGGER_ATTRIBUTE
    [DebuggerStepThrough]
    [DebuggerNonUserCode]
#endif
    public static class Application {

        /// <summary>
        /// 运行时环境
        /// </summary>
#if !DISABLE_DEBUGGER_ATTRIBUTE
        [DebuggerHidden]
#endif
        public static IRuntime Runtime => GetRuntime();
#if !DISABLE_DEBUGGER_ATTRIBUTE
        [DebuggerHidden]
#endif
        internal static Runtime GetRuntime() => m_Runtime ??= new();
        private static Runtime m_Runtime;

        /// <summary>
        /// 实现映射表
        /// </summary>
#if !DISABLE_DEBUGGER_ATTRIBUTE
        [DebuggerHidden]
#endif
        public static ITypeMap TypeMap => GetTypeMap();
#if !DISABLE_DEBUGGER_ATTRIBUTE
        [DebuggerHidden]
#endif
        internal static TypeMap GetTypeMap() => m_TypeMap ??= new();
        private static TypeMap m_TypeMap;

        public static IServices Services => GetServices();
#if !DISABLE_DEBUGGER_ATTRIBUTE
        [DebuggerHidden]
#endif
        internal static Services GetServices() => m_Services ??= new();
        private static Services m_Services;
    }
}